using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using UnityEngine;

public class JiaSuController : MonoBehaviour
{
    public float Temptime;

    private void Awake()
    {
        Temptime = 0;
        EventManager.Instance.Register<float>(EventName.JiaSuEvent, JiaSu);
    }

    private void OnDestroy()
    {
        GameManager.Instance.isJiaSu = false;
        EventManager.Instance.Unregister<float>(EventName.JiaSuEvent, JiaSu);
    }

    private void JiaSu(float obj)
    {
        Temptime += obj;
    }

    void Update()
    {
        if (Temptime >= 0)
        {
            Temptime -= Time.deltaTime;
            GameManager.Instance.isJiaSu = true;
        }
        else
        {
            GameManager.Instance.isJiaSu = false;
        }
    }
}
